<%--
  Created by IntelliJ IDEA.
  User: Lenovo
  Date: 2020/3/26
  Time: 10:40
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <title>Title</title>
</head>
<body>

<h2>记账管理</h2>
<form action="/getbills" method="post">
<p>
    类型:<select name="typeId">
    <%--这个value值一定要写--%>
    <option value="-1">
        不限
    </option>
    <c:forEach items="${billtypes}" var="billtypes">
    <option value=" ${billtypes.id}" ${billtypes.id==tid?'selected':''}>

            ${billtypes.name}

    </option>
    </c:forEach>
</select>
    时间:从<input type="text" name="beginTime" value="${beginTime}"> 到<input type="text" name="endTime" value="${endTime}">
    <input type="submit" value="搜索">
    <input type="button" value="记账">

</p>
</form>
<table>
    <tr>
        <td>标题</td>
        <td>记账时间</td>
        <td>类别</td>
        <td>金额</td>
        <td>说明</td>
        <td>删除 修改</td>
    </tr>
    <c:forEach items="${pi.list}" var="bill">
    <tr>
        <td>${bill.title}</td>
        <td><fmt:formatDate value="${bill.billTime}" pattern="yyyy-MM-dd"></fmt:formatDate> </td>
        <td>${bill.billsType.name}</td>
        <td>${bill.price}</td>
        <td>${bill.explain}</td>
        <td>删除 修改</td>
    </tr>
    </c:forEach>
<%--这个页码的前台展示不会写 这里是照着敲的--%>
        <tr>
        <td colspan="6">
        <a href="/getbills">首页</a>
        <a href="/getbills?pageIndex=${pi.prePage==0?1:pi.prePage}">上一页</a>
        <%--这种自然数的写法倒是第一次见--%>
        <c:forEach begin="1" end="${pi.pages}" var="i">
            <a href="/getbills?pageIndex=${i}">${i}</a>
        </c:forEach>
        <a href="/getbills?pageIndex=${pi.prePage==0?pi.pages:pi.nextPage}">下一页</a>
        <a href="/getbills?pageIndex=${pi.pages}">尾页</a>
        总页数:${pi.pages}
        总条数:${pi.total}
        当前页:${pi.pageNum}

        </td>
        </tr>
</table>

</body>
</html>
